import static org.junit.Assert.*;

import java.util.ArrayList;

import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.zanateh.wargame.game.*;
import org.zanateh.wargame.game.hexagon.BasicHexagon;
import org.zanateh.wargame.game.hexagon.Hexagon;
import org.zanateh.wargame.game.hexagon.HexagonFactory;
import org.zanateh.wargame.game.hexagon.TestHexagon;

public class HexagonFactoryTest {
	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testHexagonFactory() throws ClassNotFoundException {
		Hexagon hex = HexagonFactory.createHexagon('A');
		Assert.assertNotNull(hex);
		Assert.assertTrue("Class check- BasicHexagon back for A", BasicHexagon.class.isInstance(hex));  
	}
	
	@Test(expected=IllegalArgumentException.class)
	public void testBadType() {
		Hexagon hex = HexagonFactory.createHexagon(';');
	}

	@Test
	public void testTestHexagon() {
		Hexagon hex = HexagonFactory.createHexagon('T');
		Assert.assertNotNull(hex);
		Assert.assertTrue("Class check- TestHexagon back for T", TestHexagon.class.isInstance(hex));  
	}
	
	@Test
	public void testHexagonCreationByEnum() {
		Hexagon hex = HexagonFactory.createHexagon(HexagonFactory.HexagonType.BASIC);
		Assert.assertNotNull(hex);
		Assert.assertTrue("Class check- BasicHexagon back for BASIC", BasicHexagon.class.isInstance(hex));  
	}
	
	@Test
	public void testHexagonHasNoDrawable() {
		Hexagon hex = HexagonFactory.createHexagon(HexagonFactory.HexagonType.BASIC);
		Assert.assertFalse(hex.hasDrawable());
	}

}
